﻿using System;
using System.Text;
using NUnit.Framework;
using Smith.AMC.Operations;

namespace MemcachedClientTests
{
    [TestFixture]
    public class OperationTest
    {
        [Test]
        public void TestToString()
        {
            const string expectedFirstLine = @"set omg 65535 120";

            SetOperation operation = new SetOperation
                                         {
                                             Key = "omg",
                                             Expiry = TimeSpan.FromSeconds(120),
                                             Flags = 65535,
                                             Data = Encoding.ASCII.GetBytes("this is the value")
                                         };
            string operationAsString = operation.ToString();

            Assert.That(operationAsString, Is.StringContaining(expectedFirstLine));

        }
    }
}
